package com.jiruan.invoicemanagementsystem.service.imp;

import com.jiruan.invoicemanagementsystem.dao.IUserDao;
import com.jiruan.invoicemanagementsystem.dao.Imp.IUserDaoImp;
import com.jiruan.invoicemanagementsystem.pojo.User;
import com.jiruan.invoicemanagementsystem.service.IUserService;

import java.util.ArrayList;

public class IUserServiceImp implements IUserService {

    IUserDao iud=new IUserDaoImp();



    //简单的账号密码登录判断
    /**
     * @基本步骤:
     * 1.通过dao层通过用户名去查找对应用户信息
     *      ->若信息不存在(null) - 登录失败 -> 返回false
     *      ->若信息存在(User) - 判断 User.getPassword() 是否与 password 相等
     *                        -  相等 -> 返回True
     *                        -  不相等 -> 返回 False
     * */


    //接口中的方法默认是 public 权限
    @Override
   public boolean Login(String username, String password){
            User u= iud.LoginAccount(username).get(0);

        return u!=null && u.getPassword().equals(password);
}
}
